package com.cognizant.app.wiget;

import android.app.Activity;
import android.content.Context;
import android.util.AttributeSet;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.cognizant.app.R;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class TitleLayout extends LinearLayout {
    private Context mContext;
    @BindView(R.id.text_title)
    TextView mTitleTextView;
    @BindView(R.id.button_backward)
    Button mBackwardbButton;
    @BindView(R.id.button_forward)
    Button mForwardButton;

    public TitleLayout(Context context) {
        super(context, null);
        mContext = context;
    }

    public TitleLayout(final Context context, AttributeSet attrs) {
        super(context, attrs);
        mContext = context;
        View view = LayoutInflater.from(context).inflate(R.layout.activity_title, this);
        ButterKnife.bind(this, view);
    }

    public void setTitle(String title) {
        mTitleTextView.setText(title);
    }

    @OnClick(R.id.button_backward)
    public void backward() {
        Log.i("maolikui", "onClick!");
        ((Activity) mContext).finish();
    }

}
